package restsrv

import (
	"fmt"
	"sync"
)

var (
	TestHost   string
	testAppId  string
	callId     string
	recordType string
	ttsSpeed   = 1.0
	Callist    sync.Map
)

func ShowStatics() {

	number := 0
	finised := 0
	Callist.Range(func(key, value interface{}) bool {
		number++
		if value.(*callstat).status == "finish" {
			finised++
		}

		return true
	})

	fmt.Printf("all  test  call:%4d\n", number)
	fmt.Printf("normal finished:%4d\n", finised)
	Callist.Range(func(key, value interface{}) bool {

		if value.(*callstat).status != "finish" {
			fmt.Printf("call err:%s\n", key.(string))
		}

		return true
	})
	Callist.Range(func(key, value interface{}) bool {
		number++
		if value.(*callstat).status == "finish" {
			finised++
		}

		return true
	})

}

func ClearStatics() {
	Callist.Range(func(key, value interface{}) bool {
		Callist.Delete(key.(string))
		return true
	})
}

func SetRecordTypeToMp3() {

	fmt.Printf("set  record type to mp3\n")
	recordType = "mp3"
}

func SetRecordTypeToDefault() {

	fmt.Printf("set  record type to wav\n")
	recordType = ""
}

func SetTTSMrcp() {

	fmt.Printf("set  tts speed to mrcp\n")
	ttsSpeed = -1
}

func SetTTSSpeed(speed float64) {
	fmt.Printf("set  tts speed :%f\n", speed)
	ttsSpeed = speed
}

func Init() {

}
